Hệ thống xếp lịch học tín chỉ cho sinh viên CNTT trên PHP & MySQL
112.163 lượt xem;
1 <?php
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4 if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'UTF-8');
5 if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
6 ob_start();
7 $currDir = dirname(__FILE__);
8 include("{$currDir}/../db.php");
9 include("{$currDir}/../settings-manager.php");
10
11 // check if initial setup was performed or not
12 detect_config();
13 migrate_config();
14
15 $adminConfig = config('adminConfig');
16 include("{$currDir}/incFunctions.php");
17 @include_once("{$currDir}/../hooks/__global.php");
18 include("{$currDir}/../language.php");
19 include("{$currDir}/../defaultLang.php");
20 include("{$currDir}/../language-admin.php");
21
22 /* trim $_POST, $_GET, $_REQUEST */
23 if(count($_POST)) $_POST = array_trim($_POST);
24 if(count($_GET)) $_GET = array_trim($_GET);
25 if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);
26
27 // check sessions config
28 $noPathCheck=True;
29 $arrPath=explode(';', ini_get('session.save_path'));
30 $save_path=$arrPath[count($arrPath)-1];
31 if(!$noPathCheck && !is_dir($save_path)){
32 ?>
33 <link rel="stylesheet" href="adminStyles.css">
34 <center>
35 <div class="alert alert-danger">
36 Your site is not configured to support sessions correctly. Please edit your php.ini file and change the value of <i>session.save_path</i> to a valid path.
37 <br><br>
38 Current session.save_path value is '<?php echo $save_path; ?>'.
39 </div>
40 </center>
41 <?php
42 exit;
43 }
44 if(session_id()){ session_write_close(); }
45 $configured_save_handler = @ini_get('session.save_handler');
46 if($configured_save_handler != 'memcache' && $configured_save_handler != 'memcached')
47 @ini_set('session.save_handler', 'files');
48 @ini_set('session.serialize_handler', 'php');
49 @ini_set('session.use_cookies', '1');
50 @ini_set('session.use_only_cookies', '1');
51 @ini_set('session.cookie_httponly', '1');
52 @ini_set('session.use_strict_mode', '1');
53 @session_cache_expire(2);
54 @session_cache_limiter($_SERVER['REQUEST_METHOD'] == 'POST' ? 'private' : 'nocache');
55 @session_name('Jisort');
56 session_start();
57
58
59 // check if membership system exists
60 setupMembership();
61
62
63 ########################################################################
64
65 // do we have an admin log out request?
66 if(isset($_GET['signOut'])){
67 logOutUser();
68 redirect('../index.php?signIn=1');
69 }
70
71 // is there a logged user?
72 if(!$uname=getLoggedAdmin()){
73 // is there a user trying to log in?
74 if(!checkUser($_POST['username'], $_POST['password'])){
75 // display login form
76 ?><META HTTP-EQUIV="Refresh" CONTENT="0;url=../index.php?signIn=1"><?php
77 exit;
78 }else{
79 redirect('admin/pageHome.php');
80 }
81 }
82
83 ?>
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3
4 if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'UTF-8');
5 if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
6 ob_start();
7 $currDir = dirname(__FILE__);
8 include("{$currDir}/../db.php");
9 include("{$currDir}/../settings-manager.php");
10
11 // check if initial setup was performed or not
12 detect_config();
13 migrate_config();
14
15 $adminConfig = config('adminConfig');
16 include("{$currDir}/incFunctions.php");
17 @include_once("{$currDir}/../hooks/__global.php");
18 include("{$currDir}/../language.php");
19 include("{$currDir}/../defaultLang.php");
20 include("{$currDir}/../language-admin.php");
21
22 /* trim $_POST, $_GET, $_REQUEST */
23 if(count($_POST)) $_POST = array_trim($_POST);
24 if(count($_GET)) $_GET = array_trim($_GET);
25 if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);
26
27 // check sessions config
28 $noPathCheck=True;
29 $arrPath=explode(';', ini_get('session.save_path'));
30 $save_path=$arrPath[count($arrPath)-1];
31 if(!$noPathCheck && !is_dir($save_path)){
32 ?>
33 <link rel="stylesheet" href="adminStyles.css">
34 <center>
35 <div class="alert alert-danger">
36 Your site is not configured to support sessions correctly. Please edit your php.ini file and change the value of <i>session.save_path</i> to a valid path.
37 <br><br>
38 Current session.save_path value is '<?php echo $save_path; ?>'.
39 </div>
40 </center>
41 <?php
42 exit;
43 }
44 if(session_id()){ session_write_close(); }
45 $configured_save_handler = @ini_get('session.save_handler');
46 if($configured_save_handler != 'memcache' && $configured_save_handler != 'memcached')
47 @ini_set('session.save_handler', 'files');
48 @ini_set('session.serialize_handler', 'php');
49 @ini_set('session.use_cookies', '1');
50 @ini_set('session.use_only_cookies', '1');
51 @ini_set('session.cookie_httponly', '1');
52 @ini_set('session.use_strict_mode', '1');
53 @session_cache_expire(2);
54 @session_cache_limiter($_SERVER['REQUEST_METHOD'] == 'POST' ? 'private' : 'nocache');
55 @session_name('Jisort');
56 session_start();
57
58
59 // check if membership system exists
60 setupMembership();
61
62
63 ########################################################################
64
65 // do we have an admin log out request?
66 if(isset($_GET['signOut'])){
67 logOutUser();
68 redirect('../index.php?signIn=1');
69 }
70
71 // is there a logged user?
72 if(!$uname=getLoggedAdmin()){
73 // is there a user trying to log in?
74 if(!checkUser($_POST['username'], $_POST['password'])){
75 // display login form
76 ?><META HTTP-EQUIV="Refresh" CONTENT="0;url=../index.php?signIn=1"><?php
77 exit;
78 }else{
79 redirect('admin/pageHome.php');
80 }
81 }
82
83 ?>